package test04;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class demo {
    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入生日：");
        String str = sc.next();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = sdf.parse(str);        // 出生日期时间
        Date now = new Date();              // 获取当前时间
        Long birth = parse.getTime();       // 获取出生日期的毫秒值
        Long now_l = now.getTime();         // 获取当前时间的毫秒值
        System.out.println("活了"+(now_l-birth)/1000/60/60/24+"天了");
    }
}
